Adding a Table Heading in HTML 5

A table heading is used to specify the title of a particular cell. For example, while creating a student database having fields, such as student name, date of birth and address, you can specify these fields as table headers. This makes easy to understand the structure of the table.

Let’s do the following steps to add a table heading:


<!DOCTYPE html>
<head>
    <title>Table Heading</title>
</head>
<body bgcolor=”alicablue”>
<table>
<caption>
    <h2>Student Details</h2>
</caption
<tr>
    <th>Name</th>
    <th>Date of Birth</th>
    <th>Address</th>
</tr>
    <tr>
        <td>Manish Kumar</td>
        <td> 15-03-1983</td>
        <td>Flat No, 303, Shipra Suncity, Ghaziabad</td>
    </tr>
    <tr>
        <td>Rajesh Gupta </td>
        <td>22-02-1984</td>
        <td> H. No.-32, Rajendra Place, New Delhi</td>
    </tr>
    <tr>
        <td>Manisha Dubey </td>
        <td>05-02-1995</td>
        <td> H. No.-125, Patel Nagar, New Delhi</td>
    </tr>
</table>
</body>
</html>

Save the document with the name TableHeading.html. and open on browser.

add heading in table in HTML 5

Note: By default, the table headings are aligned center in bold font.